package top.jacktgq.sxt.bio.error_discrimination;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @Author CandyWall
 * @Date 2019/8/9--14:16
 * @Description jdbc方式连接数据库
 */
public class DBUtils {
    private static Connection conn;
    private static String driver = "com.mysql.jdbc.Driver";;
    private static String url = "jdbc:mysql://192.168.0.105:3306/error_discrimination";
    private static String username = "root";
    private static String password = "123";

    public static Connection getConn() {
        try {
            Class.forName(driver);
            conn = DriverManager.getConnection(url,username,password);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }

    /*public static void main(String[] args) throws SQLException {
        Connection conn = getConn();
        System.out.println(conn);
        Statement stat = conn.createStatement();
        ResultSet rs = stat.executeQuery("select * from unit");
        while (rs.next()) {
            System.out.println(rs.getString("unit_id"));
        }
    }*/
}
